package view.map;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
import view.img.ImageLibrary;

public class HexTile extends JLayeredPane
{ Polygon hexagon = new Polygon();
  BufferedImage image;
	public HexTile()
	{ super(); }
	public HexTile(String string) 
	{  
	  
	}
  @Override
	public boolean contains(Point p)
	{ return hexagon.contains(p);	}

	@Override
	public boolean contains(int x, int y){
	    return hexagon.contains(x, y);
	}
	@Override
	public void setSize(Dimension d){
	    super.setSize(new Dimension(135,117));
	    calculateCoords();
	}
	@Override
	public void setSize(int w, int h){
	    super.setSize(135, 117);
	    calculateCoords();
	}
	@Override
	public void setBounds(int x, int y, int width, int height){
	    super.setBounds(x, y, 135, 117);
	    calculateCoords();
	}
	@Override
	public void setBounds(Rectangle r){
	    super.setBounds(new Rectangle(r.x,r.y,135,117));
	    calculateCoords();
	}
	public void calculateCoords()
	{ //w = 117;
		//h = 135;
		int cordX[] = new int[6];
		int cordY[] = new int[6];
		int numPnts = 6;

		cordX[0] = 34;
		cordY[0] = 0;
		
		cordX[1] = 100;
		cordY[1] = 0;
		
		cordX[2] = 135;
		cordY[2] = 58;
		
		cordX[3] = 100;
		cordY[3] = 117;
		
		cordX[4] = 34;
		cordY[4] = 117;
		
		cordX[5] = 0;
		cordY[5] = 58;
			
		hexagon = new Polygon(cordX, cordY, numPnts);
	}

	public void paintComponent(Graphics g)
	{ //g.drawImage(ImageLibrary.getImage("tile"), 0, 0, this); 
	  
	}
	
	public void paintBorder(Graphics g)
	{ /*Nothing!*/ }
	
}